<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.min.js" ></script>
    <script>
        function getFormData() {
            var data = $("#f1").serialize();
            console.log(data);// 字符串类型

            var arr = $("#f1").serializeArray();
            console.log(arr);
        }
    </script>
</head>
<body>
    <form id="f1">
        username:<input type="text" name="username"><br>
        password:<input type="password" name="password"><br>
        <br>
        <button type="button" onclick="getFormData()">getFormData</button>
    </form>
</body>
</html>